package com.qiguliuxing.dts.db.dao.ex;

import com.qiguliuxing.dts.db.domain.DtsCoupon;
import com.qiguliuxing.dts.db.domain.DtsCouponUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 优惠券扩展DAO层接口
 * @author qiguliuxing
 * @since 1.0.0
 */
public interface CouponMapperEx {

	@Select({
			"select * from dts_coupon where deleted = 0 ",
			"and status = #{paramsMap.status} and timeType = #{paramsMap.timeType} ",
			"and endTime &lt;= #{paramsMap.endTime} ",
			"and mod(id, #{paramsMap.shardingTotalCount,jdbcType=INTEGER})=#{paramsMap.shardingItem,jdbcType=INTEGER}"
	})
	List<DtsCoupon> queryExpiredCoupon(@Param("paramsMap") Map<String, Object> paramsMap);

	@Select({
			"select * from dts_coupon_user where deleted = 0 ",
			"and status = #{paramsMap.status} ",
			"and endTime &lt;= #{paramsMap.endTime} ",
			"and mod(id, #{paramsMap.shardingTotalCount,jdbcType=INTEGER})=#{paramsMap.shardingItem,jdbcType=INTEGER}"
	})
	List<DtsCouponUser> queryExpiredUserCoupon(@Param("paramsMap") Map<String, Object> paramsMap);
}